﻿//---------------------------------------------------------------------
// <copyright file="IEntityDescriptorValueCalculator.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Test.Taupo.Astoria.Contracts.Client
{
    using System;
    using Microsoft.Test.Taupo.Common;

    /// <summary>
    /// Contract for calculating the expected entity descriptor values that will be generated by the data service context
    /// </summary>
    [ImplementationSelector("EntityDescriptorValueCalculator", DefaultImplementation = "Default", HelpText = "The calculator of the expected entity descriptor values that will be generated by the data service context.")]
    public interface IEntityDescriptorValueCalculator
    {
        /// <summary>
        /// Calculates an entity id based on the base uri, entity set resolver, set name, and entity key values
        /// </summary>
        /// <param name="contextData">The context data</param>
        /// <param name="entitySetName">the entity set name</param>
        /// <param name="entity">The entity to generate an id for</param>
        /// <returns>The id for the given entity</returns>
        Uri CalculateEntityId(DataServiceContextData contextData, string entitySetName, object entity);

        /// <summary>
        /// Calculates an edit link based on the base uri, entity set resolver, set name, and entity key values
        /// </summary>
        /// <param name="contextData">The context data</param>
        /// <param name="entitySetName">the entity set name</param>
        /// <param name="entity">The entity to generate an edit link for</param>
        /// <returns>The edit link for the given entity</returns>
        Uri CalculateEditLink(DataServiceContextData contextData, string entitySetName, object entity);

        /// <summary>
        /// Calculates the key for an entity, which is used to build uris for link update and delete operations
        /// </summary>
        /// <param name="entity">The entity to build a key for</param>
        /// <returns>The key of the entity</returns>
        string CalculateEntityKey(object entity);
    }
}
